Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Kill  Process  under  a  different  security  context  

 Content of Kill Process under a different security context.vbs
MD5 Hash: BC4C409177243BED9003B7E860B10C65
Option Explicit

Dim strComputer : strComputer = "."
Dim strProcessName : strProcessName = "notepad.exe"
Dim oWMIService : Set oWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

oWMIService.Security_.ImpersonationLevel = 3
oWMIService.Security_.privileges.addasstring "SeDebugPrivilege", True

Dim colProcessList : Set colProcessList = oWMIService.ExecQuery("Select * from Win32_Process Where Name = " & Chr(34) & strProcessName & Chr(34))
Dim oProcess

For Each oProcess in colProcessList
oProcess.Terminate()
Next

Set oWMIService = Nothing
Set colProcessList = Nothing

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a